<include file="public@header"/>
<style type="text/css">

    .p_title {
        width: 515px;
        margin: 0 0 45px 60px;
        padding: 10px 0 10px 20px;
    }
    .w100{
        width: 100px !important;}
    tr td input,tr td select{ max-width:80px;width:auto;}
    .content_nav .check_info{flex:1; display:flex;flex-direction: column;align-items: center;justify-content: center;}

    .form-control{
        width:100%; display:inline-block;
    }
    .free .form-group{
        margin-top: 30px;}
</style>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('orders/visua')}">{:lang('可视化墓区')}</a></li>
        <li><a href="{:url('Deposit/tomb_deposit')}?order_id={$order_id}">格位信息</a></li>
        <li><a href="{:url('Deposit/deposit_applyer')}?order_id={$order_id}">寄存人信息</a></li>
        <li><a href="{:url('Deposit/deposit_user')}?order_id={$order_id}">逝者信息</a></li>
        <li><a href="{:url('Deposit/signcontract')}?order_id={$order_id}">合同签订</a></li>
        <li class="active"><a href="">订单支付</a></li>

    </ul>
    <form class="form-horizontal  " action="{:url('Deposit/orderPay')}" method="post" enctype="multipart/form-data">
        <fieldset>
            <!--改版画面-->
            <div class="div_title"><span>客户概览</span></div>
            <div class="control-group1-p div_content">
                <div class="form-group">
                    <label class="control-label w100">客户姓名</label>
                    <div class="col-lg-2"  >
                        <input type="text"  class="form-control" value="{$customer.buyer_name}" disabled>
                    </div>
                    <label class="control-label w100">持证类型</label>
                    <div class="col-lg-2"  >
                        <input type="text" class="form-control" value="{:cart_type('cart',$customer.cart_type)}" disabled>
                    </div>
                    <label class="control-label w100">证件号码</label>
                    <div class="col-lg-2"  >
                        <input type="text"  class="form-control" value="{$customer.customer_account}" disabled>
                    </div>
                    <label class="control-label w100"  >联系电话</label>
                    <div class="col-lg-2" >
                        <input type="text"  class="form-control" value="{$customer.buyer_phone}" disabled>
                    </div>
                </div>
                <div class="form-group" >
                    <label class="control-label w100">联系地址</label>
                    <div class="col-lg-2"  >
                        <input type="text"   class="form-control" value="{$customer.customer_address}" disabled>
                    </div>
                    <label class="control-label w100">合同编号</label>
                    <div class="col-lg-2" >
                        <input type="text" name="user_login" class="form-control" value="{$result.contract_sn}" disabled>
                    </div>
                    <label class="control-label w100">墓位编号</label>
                    <div class="col-lg-2"  >
                        <input type="text" name="user_login" class="form-control" value="{$result.tomb_num}" disabled>
                    </div>
                    <label class="control-label w100">具体位置</label>
                    <div class="col-lg-2"  style="width: 19% ">
                        <input type="text" name="user_login" class="form-control" value="{$result.tomb_region}" disabled>
                    </div>
                </div>
                <div class="form-group" >
                    <label class="control-label w100">当前状态</label>
                    <div class="col-lg-2"  >
                        <input type="text" name="user_login" class="form-control" value="{$result.pro_status}" disabled>
                    </div>
                    <label class="control-label w100" >格位规制</label>
                    <div class="col-lg-2" >
                        <input type="text" name="user_login" class="form-control" value="双穴" disabled>
                    </div>
                </div>
                <div class="row" style="margin: 0;padding: 0;" >
                    <div class="col-md-6">
                        <div class="row">
                            <div class="col-md-12" style="padding: 0 5px 10px 10px;">
                               <div class="box box-info">
                                    <div class="box-header" style="border: 2px solid #0b7ebf;overflow:hidden; overflow-x:auto;">
                                        <div class="div_title" ><span>交款记录</span></div>
                                    </div>

                                    <div class="box-body" style="padding-top:0; height: 225px; border: 2px solid #0b7ebf;overflow:hidden; overflow-x:auto;" >
                                        <table class="table table-hover table-bordered" style="max-width:120% !important;width:120% !important">
                                            <thead>
                                            <tr>
                                                <th>寄存单号</th>
                                                <th>类型</th>
                                                <th>付/退款人姓名</th>
                                                <th>付/退款人时间</th>
                                                <th>金额</th>
                                                <th>付/退款人方式</th>
                                                <th>经办人</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            <foreach name="deposit" item="vo">
                                                <tr>
                                                    <td >{$vo.deposit_sn}</td>
                                                    <td >{$vo.deposit_type}</td>
                                                    <td >{$vo.real_name}</td>
                                                    <td >{$vo.add_time|date='Y-m-d H:i:s'}</td>
                                                    <td >{$vo.deposit_price}</td>
                                                    <td >现金</td>
                                                    <td >{:cmf_get_admin_name($vo.handle)}</td>
                                                </tr>
                                            </foreach>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-12" style="padding: 0 5px 5px 10px;">
                                <div class="box box-info">
                                    <div class="box-header" style="border: 2px solid #0b7ebf;overflow:hidden; overflow-x:auto;">
                                        <div class="div_title" ><span>结算项目</span></div>
                                    </div>
                                    <div class="box-body" style="padding-top:0; border: 2px solid #0b7ebf;overflow:hidden; overflow-x:auto;" >
                                        <div class="div_title" id="div_title" style="width:120%; background:#DEDDDD;box-shadow: 5px -5px 3px #CFCECE inset;"><span style="color:#222;">墓穴销售</span></div>
                                        <div class="div_titleinfo" style="width:100%;">
                                                <table class="table table-hover table-bordered" style="max-width:120% !important;width:120% !important">
                                                    <thead>
                                                    <tr>
                                                        <th>墓位编号</th>
                                                        <th>类型</th>
                                                        <th>流程</th>
                                                        <th>单位</th>
                                                        <th>数量</th>
                                                        <th>价格</th>
                                                        <th>下单时间</th>
                                                        <th>导购员</th>
                                                        <th>代理商</th>
                                                        <th>抵顶人</th>
                                                    </tr>
                                                    </thead>
                                                    <tbody>
                                                    <tr>
                                                        <td >{$result.tomb_num}</td>
                                                        <td >壁墓</td>
                                                        <td >寄存</td>
                                                        <td >套</td>
                                                        <td >1</td>
                                                        <td >{$result.selling_price}</td>
                                                        <td >{$result.add_time}</td>
                                                        <td >{:cmf_get_admin_name($result.shoppingguide)}</td>
                                                        <td >{:cmf_get_admin_name($result.agent_user)}</td>
                                                        <td >{$result.reacher}</td>
                                                    </tr>
                                                    </tbody>
                                                </table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-lg-6 free">
                        <div class="box box-info">
                            <div class="box-header" style="border: 2px solid #0b7ebf;overflow:hidden; overflow-x:auto;">
                                <div class="div_title" ><span>费用信息</span></div>
                            </div>
                            <div class="box-body" style="padding-top:0; border: 2px solid #0b7ebf;overflow:hidden; overflow-x:auto;" >
                                <div class="form-group" >

                                    <label class="control-label"  >寄存时长</label>
                                    <div class="col-md-3"  >
                                        <input type="hidden" name="deposit_storage"  value="{$result.deposit_storage}" />
                                        <input type="text" name="deposit_storage" class="form-control deposit_storage" data-deposit_storage="{$result.deposit_storage}" style="width: 130px"     value="{$result.deposit_storage}" disabled>年
                                    </div>
                                    <label class="control-label" >单年费用</label>
                                    <div class="col-md-3"  >
                                        <input type="hidden" name="selling_price" value="{$result.selling_price}" />
                                        <input type="text" name="selling_price" class="form-control selling_price" style="width: 130px"  value="{$result.selling_price}"disabled >元/年
                                    </div>
                                </div>
                                <div class="form-group" >
                                    <label class="control-label" >优惠方案</label>
                                    <div class="col-md-3" style=" ">
                                        <if condition="$result.closing_price eq '1500.00'">
                                            <input type="hidden" name="discount_duration" value="1500/5" />
                                            <else/>
                                            <input type="hidden" name="discount_duration" value="{$result.discount_duration}" />
                                        </if>

                                        <select style=" width:auto;" class="form-control discount_duration" name="discount_duration" disabled>
                                            <option value="0">无优惠</option>
                                            <if condition="isset($result['closing_price'])">
                                                <option value="1500/5" data-y="5" data-jg="1500"  <if condition="$result.closing_price eq '1500.00'">selected</if>>￥1500/5年</option>
                                                <else/>
                                                <option value="1500/5" data-y="5" data-jg="1500">￥1500/5年</option>
                                            </if>
                                        </select>
                                    </div>
                                    <label class="control-label" >免费寄存</label>
                                    <div class="col-md-3"  >
                                        <input type="hidden" name="discount_price" value="{$result.discount_price}" />
                                        <select    name="discount_price" class="form-control discount_price" disabled>
                                            <option value="0">0年</option>
                                            <if condition="isset($result['deposit_storage'])">
                                                <option value="1" <if condition="$result.discount_price eq 1">selected</if> >一年</option>
                                                <option value="2" <if condition="$result.discount_price eq 2">selected</if> >两年</option>
                                                <option value="3" <if condition="$result.discount_price eq 3">selected</if> >三年</option>
                                                <else/>
                                                <option value="1" >一年</option>
                                                <option value="2" >两年</option>
                                                <option value="3" >三年</option>
                                            </if>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group" >
                                    <label class="control-label" >合计应收</label>
                                    <div class="col-md-3" style=" ">
                                        <input type="hidden" name="total_price" class=" total_price" value="{$result.closing_price}" />
                                        <input type="hidden" class="closing_price"  name="deal_price" value="{$result.closing_price}" >
                                        <input type="text"  class="form-control closing_price_"  value="￥{$result.closing_price}" disabled style="width: 150px">元
                                    </div><label class="control-label">付款方式</label>
                                    <div class="col-lg-3" style=" ">
                                        <select name="pay_type"   class="form-control">
                                            <option value="1">现金</option>
                                            <option value="2">转账</option>
                                            <option value="3">电汇</option>
                                            <option value="4">微信</option>
                                            <option value="5">支付宝</option>
                                            <option value="6">其他</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group" >
                                    <label class="control-label">付款人</label>
                                    <div class="col-md-3" style=" ">
                                        <input type="text"  name="real_name" class="form-control"  value="{$customer.buyer_name}">
                                    </div>
                                    <label class="control-label">付款人手机号</label>
                                    <div class="col-md-3" style=" ">
                                        <input type="text"  name="real_phone" class="form-control"  value="{$customer.buyer_phone}">
                                    </div>
                                </div>
                                <div style="float:left; width:90%; margin-left:6%;border-bottom:1px dashed;margin-bottom:20px;"></div>
                                <div class="form-group" >
                                    <label class="control-label">收银备注</label>
                                    <div class="col-lg-7" style=" ">
                                        <textarea rows="3" name="remark" class="form-control" ></textarea>
                                    </div>
                                </div>
                                <div class="form-group" >
                                    <label class="control-label">付款时间</label>
                                    <div class="col-md-3" style=" ">
                                        <input type="text" name="add_time" class="form-control js-date"  value='{$result.payaddtime}' autocomplete="off">
                                    </div>
                                    <label class="control-label">收款人</label>
                                    <div class="col-md-3" style=" ">
                                        <input type="text" name="user_login" class="form-control"  value="{:cmf_get_admin_name()}" disabled>
                                    </div>
                                </div>

                                <div class="form-group" >
                                    <div class="col-lg-12" style=" ">
                                        <label class="control-label"> </label>
                                        <input type="hidden" name="tomb_type"   value="1">
                                        <input type="hidden" name="dtype" id="otype" value="">
                                        <input type="hidden" name="order_id" value="{$result.order_id|default=''}">
                                        <input type="hidden" name="tomb_id" value="{$result.tomb_id|default=''}">
                                        <input type="hidden" name="tomb_num" value="{$result.tomb_num|default=''}">
                                        <input type="hidden" name="customer_id" value="{$result.customer_id|default=''}">
                                        <div class="btn btn-primary" id="check-save">保存</div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </fieldset>
    </form>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js?v={:time()}"></script>
<script type="text/javascript">

    $(function () {
        // var closing_price = $('.deposit_storage').val()* $('.selling_price').val();

        // $('.total_price').val(closing_price)
        // $('.closing_price').val(closing_price)
        // $('.closing_price_').val('￥'+closing_price)
    })

    $('.discount_duration').change(function () {
        var jg = $(this).children('option:selected').data('jg');
        var nian = $(this).children('option:selected').data('y');
        console.log()
        $('.closing_price').val(jg);
        $('.closing_price_').val('￥'+jg)
        $('.discount_price').val(0)
        $('.total_price').val(jg)
        $('.deposit_storage').val(nian)

    })
    $('.discount_price').change(function () {
        $('.discount_duration').val(0)
        var discount_price = $(this).val();
        var  deposit_storage = $('.deposit_storage').data('deposit_storage');
        $('.deposit_storage').val(deposit_storage);
        var closing_price = ($('.deposit_storage').val()-discount_price)*$('.selling_price').val()
        $('.closing_price').val(parseFloat(closing_price).toFixed(2));
        $('.closing_price_').val('￥'+(parseFloat(closing_price).toFixed(2)))

        $('.total_price').val(parseFloat(closing_price).toFixed(2))
    })

    // 提交保存
    $("#check-save").click(function(){
        $("#otype").val(1);
        $.post($(".form-horizontal").attr('action'), $(".form-horizontal").serialize(), function(result){
            if(result.code == 1){
                layer.confirm(result.msg, {
                    icon: 1, btn: ['确认']
                    , btn1: function () {
                        window.location.href = result.url;
                    }
                });
            } else {
                layer.alert(result.msg, { icon: 5 });
            }
        }, 'json');
    });
    // 打印结算单
    $("#Print_statement").click(function(){
        $("#otype").val(2);
        $.post($(".form-horizontal").attr('action'), $(".form-horizontal").serialize(), function(result){
            if(result.state == 'success'){
                alert("保存成功！");
                $('#js-dialog-close').click();
            } else {
                alert(result.info);
            }
        }, 'json');
    });
    // 退款
    $("#Refund").click(function(){
        $("#otype").val(3);
        $.post($(".form-horizontal").attr('action'), $(".form-horizontal").serialize(), function(result){
            if(result.state == 'success'){
                alert("保存成功！");
                $('#js-dialog-close').click();
            } else {
                alert(result.info);
            }
        }, 'json');
    });
    // 结账
    $("#Bill_please").click(function(){
        $("#otype").val(4);
        $.post($(".form-horizontal").attr('.form-horizontal'), $("form").serialize(), function(result){
            if(result.state == 'success'){
                alert("保存成功！");
                $('#js-dialog-close').click();
            } else {
                alert(result.info);
            }
        }, 'json');
    });
    $("#div_title").click(function(){
        if($(".div_titleinfo").is(":hidden")){
            $(".div_titleinfo").show();
        }else{
            $(".div_titleinfo").hide();
        }
    })
    $("#div_title1").click(function(){
        if($(".div_titleinfo1").is(":hidden")){
            //
            $(".div_titleinfo1").show();
        }else{
            $(".div_titleinfo1").hide();
        }
    })
</script>
</body>
</html>